﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Snake
{
    /// <summary>
    /// A toplistát megjelenítő form
    /// </summary>
	public partial class toplistWindow : Form
	{
		public toplistWindow(Player[] players, Player current)
		{
			InitializeComponent();
			listView.Clear();
			listView.Columns.Add("Név", 197);
			listView.Columns.Add("Pontok", 167);
			foreach (Player p in players)
			{
				if (p.name == current.name && p.points == current.points)
				{
					ListViewItem item = new ListViewItem(new string[] { p.name, p.points.ToString() });
					item.BackColor = Color.Red;
					listView.Items.Add(item);
				}
				else
				{
					listView.Items.Add(new ListViewItem(new string[] { p.name, p.points.ToString() }));
				}
			}
		}

        /// <summary>
        /// Ez az eljárás hívódik meg akkor, amikor a felhasználó rákattint az OK gombra.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
		private void okButton_Click(object sender, EventArgs e)
		{
			Close();
		}
	}
}
